<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <base target="_self"/>
    <link rel="stylesheet" type="text/css" href="<%=path %>/web/style/layout.css" />
    <script type="text/javascript" src="<%=path %>/jqGrid/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path %>/jslib/jquery.validate.min.js"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/My97DatePicker/WdatePicker.js" defer="defer"></script>
    <script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/additional-methods.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/demo.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <c:if test="${requestScope.message!=null}">
		<script type="text/javascript">
 	 		     alert('<c:out value="${requestScope.message}"></c:out>');
 	 		     window.close();
 		</script>
	</c:if>
	
    <script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    var stateValue="";
    $().ready(function(){
            
			var options = {
		  	    url:'<%=request.getContextPath() %>/Shebeixianzhi!chuliShebei.action?steptype='+$("#steptype0").val()+'&taskinfoid='+${taskinfoid},
		  	     beforeSubmit: function() {
		   				return  checking();
		    			},
		  	    dataType:'json',
		  	    success: function(data) {
		  	    //alert(data);
		  	      if(data.result=='success'){
					alert("提交成功");
				//	window.close();
					W.reload();
					api.close();

		  	      }
		  	    }};
		$('#saveBtn').click(function(){
			    	$('#pageFrom').ajaxSubmit(options);
	 	            return false;
    	 });
    	$('#closeBtn').click(function(){
    		api.close();
			//window.close();
		});
		
	});
	
   	function checking(){
   		var flag = true;
		var shenqinren = $("#shenqinren").val();
		var shenpiren = $("#shenpiren").val();
		var flowname = $.trim($("#flowname").val());
		if(shenqinren ==null || shenqinren == "" ){
			alert("申请人不能为空！");
			$("#shenqinren").focus();
    		return false;
		}
		if(shenpiren == null && shenpiren == ""){
			alert("审批人不能为空！");
			$("#shenpiren").focus();
    		return false;
		}
		if(flowname ==null || flowname == "" ){
			alert("流程名称不能为空！");
			$("#flowname").focus();
			return false;
		}
		
	}
	 
	
	function countlen1(textarea){
	       var elem = event.relatedTarget || event.srcElement || event.target ||event.currentTarget;    
	        if(event.keyCode!=8)
			{
			  if (textarea.value.length> 249){
			        alert("最多为250个字符,字符输入超出限制!");
			        textarea.value=textarea.value.substring(0,249);
			    }
			    return true;
	 	    }
	}
		
	
	function dahui(){
        var actionUrl = '<%=request.getContextPath()%>/Shebeixianzhi!tuihuiShebei.action'; 
        var param = {
                      "flowname":$("#flowname").val(),
                      "flowid":"${flowid}",
                      "stateid":"${stateid}",
                      "steptypeback":$("#steptypeback0").val(),
                      "taskinfoid":"${taskinfoid}",
                      "shebeiid":$("#shebeiid").val()
            };
    	$.ajax({  
			        url : actionUrl,  
			        type : "post", 
			        data : param,  
			        dataType : "json",  
			        cache : false,  
			 error : function(textStatus, errorThrown) {  
			        alert("系统ajax交互错误: " + textStatus.value);  
		    },  
		    success : function(data, textStatus) {
		        if(data.ajaxResult=='success'){ 
		        //      window.returnValue = returnValue;     
				      alert("打回成功");
				      W.reload();
					  api.close();
                   }else{
                       alert("处理失败!");
                       W.reload();
                   }
		    }    
			});
    }

   </script>
 	<style type="text/css">
 		body{
 			background:#ffffff; background-image:url(images/);
 		}
   		html{
		    overflow-x: hidden;
			overflow-y: hidden;
		}  	
		.formTableNew textarea{border: 1px solid #999;padding: 5px;width: 760px;-moz-border-radius: 3px;border-radius: 3px;margin-bottom: 5px;color: #666;background: url(../images/input_bg.gif) repeat-x top;}
   </style>
  </head>
  
  <body>
<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
        <input type="hidden" name="flowid" id="flowid" value="${flowid}">
     	<input type="hidden" name="stateid" id="stateid" value="${stateid}">
     	<input type="hidden" name="xianzhiid" id="xianzhiid" value="${requestScope.id}">
     	${steptcontent}
  		${steptcontentback }
     	<input type="hidden" name="shebeiid" id="shebeiid" value="${shebeixianzhi.id}">
     	
  		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  		<tr>
			  <td align="right">流程名称:</td>
     		<td>
     		  	<input type="text" id="flowname" name="flowname" readonly="readonly" maxlength="50" value="${flowname}" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"/>
     			<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
     		</td>
  			</tr>
  			<tr>
				<td align="right">设备名称：</td>
				<td align="left">
				<input type="text" id="equName" readonly="readonly" maxlength="50"	name="equName"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.equName}" /> 	
				</td>
				<td align="right">设备编号：</td>
				<td align="left"><input type="text" id="equNo" readonly="readonly" maxlength="50" name="equNo" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.equNo}" /> 
			</tr>
			<tr>
				<td align="right">规格型号：</td>
				<td align="left">
				<input type="text" id="equGuge" maxlength="50" readonly="readonly" name="equGuge" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="${shebeixianzhi.equGuge}" /> 
				</td>
				<td align="right">部门：</td>
				<td align="left"><input type="text" id="equOrgName" readonly="readonly"	maxlength="50" name="equOrgName" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="${shebeixianzhi.equOrgName}" />
				</td>
			</tr>
			<tr>
				<td align="right">固定资产编码：</td>
				<td align="left"><input type="text" id="equHtNo" maxlength="50" readonly="readonly"	name="zichanNo"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.zichanNo}" /> 
				</td>
				<td align="right">购进日期（转固日期）：</td>
				<td align="left"><input type="text" id="equGjDate" name="equGjDate" readonly="readonly"  	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.equGjDate}" /> 
				</td>
			</tr>
			<tr>
				<td align="right">停用日期：</td>
				<td align="left"><input type="text" id="tingyonDate" maxlength="3" readonly="readonly" onChange="changePrice()"	name="tingyonDate"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.tingyonDate}" />	
				</td>
				<td align="right">已经使用时间（月）：</td>
				<td align="left"><input type="text" id="equYjsysj" readonly	maxlength="50" name="equYjsysj"	readonly="readonly"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.equYjsysj}" /> 
				</td>
			</tr>
			<tr>
				<td align="right">原值（元）：</td>
				<td align="left"><input type="text" id="equYzhi" maxlength="50"	name="equYzhi" readonly="readonly"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.equYzhi}" /> 	
				</td>
				<td align="right">原值（万元）：</td>
				<td align="left"><input type="text" id="equYzw"  maxlength="50"	name="equYzw" readonly="readonly"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.equYzw}" /> 	
				</td>
			</tr>
			<tr>
				<td align="right">存放地点：</td>
				<td align="left"><input type="text" id="cfangdidian" maxlength="50" name="cfangdidian" readonly="readonly"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.cfangdidian}" /> 	
				</td>
				<td align="right">设备状态：</td>
  			  <td align="left">
  			  	<select id="state" class='fselect' name="state" class='easyui-validatebox' style="border: 1px solid #999;padding: 5px;width:250px;height:25px;" value="${shebeixianzhi.state}" >
 			      <option value="状态1">状态1</option>
			 	  <option value="状态2">状态2</option>
 			    </select>
  			  </td>
			</tr>
			<tr>
			<tr>
				<td align="right">闲置前使用情况描述 :</td>
				<td align="left"><input type="text" id="xzqRemark"	maxlength="50" name="xzqRemark"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="${shebeixianzhi.xzqRemark}" /> 
				</td>
				<td align="right">闲置原因描述：</td>
				<td align="left"><input type="text" id="xzmiaoshu"	maxlength="50" name="xzmiaoshu"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="${shebeixianzhi.xzmiaoshu}" /> 	
				</td>
			</tr>
			<tr>
				<td align="right">闲置原因附件 :</td>
				 <td align="left">
  			  <input type="hidden" id="XZFUJIAN" name="XZFUJIAN" />
				<jsp:include page="../fileupload/attachment.jsp?id=${shebeixianzhi.id }&column=XZFUJIAN&show=n" ></jsp:include>
  			    </td>
				<td align="right">申请人：</td>
				<td align="left"><input type="text" id="shenqinren" readonly="readonly"	maxlength="50" name="shenqinren" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.shenqinren}" />
				</td>
			</tr>
			<tr>
				<td align="right">申请日期 :</td>
				<td align="left"><input type="text" id="sqDate" readonly="readonly" maxlength="50" name="sqDate"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="${shebeixianzhi.sqDate}" /> 	
				</td>
				<td align="right">生产厂家：</td>
				<td align="left"><input type="text" id="sccj" maxlength="11"	name="sccj" onChange="changePrice()"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="${shebeixianzhi.sccj}" /> 
				</td>
			</tr>
			<td align="right">审批人 ：</td>
  			  <td align="left">
  			  	 <input type="hidden" id="shenpirenId" name="shenpirenId"/>
  			  	 <input  type="text"  id="shenpiren" readonly maxlength="50"  name="shenpiren" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"  value="<%=session.getAttribute("username")%>" />
  			  </td>
  			  <td align="right"  >审批意见：</td>
		    <td colspan="3">
		    	<div class="div">
					<textarea rows="5" cols="100" id="shenpiyijian" name="shenpiyijian" onkeydown="countlen1(this);" style="width: 250px;"></textarea>
				</div>	
		    </td>
			</tr>
			<tr>
				<td align="right">审批日期 :</td>
				<td align="left"><input type="text" id="shenpiDate" readonly="readonly" maxlength="50" name="sqDate"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="<%=DateUtilsAll.dateToStringShort(new Date()) %>" /> 	
				
			</tr>
  			
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center">
		    	<input id="saveBtn" type="button" value="提 交" class="form_bt_orange" />
		    	<input id="backBtn" onclick="dahui()" type="button" value="打 回" class="form_bt_orange" />
		    	<input type="button" id="closeBtn" value="取 消" class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
  </body>
</html>
